import { Component, Vue } from 'vue-property-decorator'
import InfoBlock from '@profile/util/info_block/Index.vue';
import { User } from '@entity/user';
import axios from '@axios/user';

@Component({
    components: {
        InfoBlock
    }
})
export class InfoBase extends Vue {

    /** 用户 */
    private me: User = this.$store.getters.me(true);

    /**
     * 更新信息, 服务端更新成功后才更新本地
     */
    private save(): void {
        axios.update.base(this.me).then(res => {
            if (res) {
                this.me = this.$store.getters.updateMe(this.me);
            }
        });
    }

    /** 
     * 取消编辑
     */
    private cancel(): void {
        this.me = this.$store.getters.me(true);
    }
    
}